export interface Vector {
    x: number,
    y: number
}

export function Create(x: number, y: number): Vector {
    return { x: x, y: y };
}

export function Add(v1: Vector, v2: Vector): Vector {
    return Create(v1.x + v2.x, v1.y + v2.y);
}

export function Equal(v1: Vector, v2: Vector) {
    return v1.x == v2.x && v1.y == v2.y;
}

export function Map(mapx: (v: number) => number, mapy: (v: number) => number, source: Vector): Vector {
    return Create(mapx(source.x), mapy(source.y));
}
